/**
 * 
 */
package com.point.business.database.model;

import java.util.Date;

/**
 * @author Ilija Trajkoski
 * 
 */
public class Schedule {
	private int id;
	private int userId;
	private boolean active;
	private String searchQuery;
	private String objectType;
	private Date lastAlertSentDate;
	private Date searchDate;

	/**
	 * @return the id
	 */
	public int getId() {
		return id;
	}

	/**
	 * @param id
	 *            the id to set
	 */
	public void setId(int id) {
		this.id = id;
	}

	/**
	 * @return the userId
	 */
	public int getUserId() {
		return userId;
	}

	/**
	 * @param userId
	 *            the userId to set
	 */
	public void setUserId(int userId) {
		this.userId = userId;
	}

	/**
	 * @return the active
	 */
	public boolean isActive() {
		return active;
	}

	/**
	 * @param active
	 *            the active to set
	 */
	public void setActive(boolean active) {
		this.active = active;
	}

	/**
	 * @return the searchQuery
	 */
	public String getSearchQuery() {
		return searchQuery;
	}

	/**
	 * @param searchQuery
	 *            the searchQuery to set
	 */
	public void setSearchQuery(String searchQuery) {
		this.searchQuery = searchQuery;
	}

	/**
	 * @return the lastAlertSentDate
	 */
	public Date getLastAlertSentDate() {
		return lastAlertSentDate;
	}

	/**
	 * @param lastAlertSentDate
	 *            the lastAlertSentDate to set
	 */
	public void setLastAlertSentDate(Date lastAlertSentDate) {
		this.lastAlertSentDate = lastAlertSentDate;
	}

	/**
	 * @return the objectType
	 */
	public String getObjectType() {
		return objectType;
	}

	/**
	 * @param objectType
	 *            the objectType to set
	 */
	public void setObjectType(String objectType) {
		this.objectType = objectType;
	}

	public Date getSearchDate() {
		return searchDate;
	}

	public void setSearchDate(Date searchDate) {
		this.searchDate = searchDate;
	}

	public String getSearchedFor(String searchQuery) {
		String result = searchQuery.replace("SELECT * FROM", "");
		result = result.replace("information", "");
		result = result.replace("ORDER BY insertionDate LIMIT 0,20", "");
		result = result.replace("WHERE 1=1  and", "");
		result = result.replace("_sl", "Стечајни постапки и ликвидации со: ");
		result = result.replace("_nd", "Лични документи со: ");
		result = result.replace("_no", "Нотарски објави со: ");
		result = result.replaceAll("LIKE", "=");
		result = result.replaceAll("and", "и");
		result = result.replaceAll("'%%'", "сите");
		result = result.replace("embs", "Ембс на субјект");
		result = result.replace("uuid", "Идентификациски број");
		result = result.replace("`procedure`", "Име на постапка");
		result = result.replace("title", "Назив на субјект");
		result = result.replace("description", "Опис на субјект");
		result = result.replace("type", "Тип на документ");
		result = result.replace("fullName", "Име и презиме");
		result = result.replace("documentNumber", "Број на документ");
		result = result.replaceAll("'%", "");
		result = result.replaceAll("%'", "");
		return result;
	}

}
